fix: forward incoming auth headers in webpack dev proxy#1013
fix: forward incoming auth headers in webpack dev proxy#1013mturley wants to merge 1 commit intokubeflow:notebooks-v2from
Conversation
The webpack dev server captures the kubeconfig token at startup and sets it as a static proxy header. This overwrites any dynamically forwarded auth headers from a host backend proxy, breaking dev impersonation. Replace the static headers approach with an onProxyReq callback that dynamically forwards the Authorization header from each incoming request when present, falling back to the startup-captured token for standalone dev mode. Signed-off-by: Mike Turley <mturley@redhat.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Mike Turley <mike.turley@alum.cs.umass.edu>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
thaorell
left a comment
There was a problem hiding this comment.
/lgtm
I have tested and the changes work accordingly, @caponetto can you (optionally) offer a secondary review on this?
|
/ok-to-test |
|
Thanks @mturley! /lgtm |
|
/hold We are looking with the MR folks to see why they did this in this way. |
|
@ederign the MR PR is merged now, should we unhold this one? Not sure if I missed discussions about the approach. cc @lucferbux |
Description
The webpack dev server captures the kubeconfig token at startup and sets it as a static proxy header via
headers: getProxyHeaders(). This overwrites any dynamically forwarded auth headers from a host backend proxy, breaking dev impersonation (e.g.DEV_IMPERSONATE_USER/DEV_IMPERSONATE_PASSWORD).This PR replaces the static
headersapproach with anonProxyReqcallback that dynamically forwards theAuthorizationheader from each incoming request when present, falling back to the startup-captured token for standalone dev mode.The same fix was applied to the model-registry UI in kubeflow/hub#2544.
Changes
getProxyHeaders()into:getKubeconfigToken()— captures kubeconfig token at startup (fallback)getProxyHeaders()— returns only static headers (kubeflow-useridforinternalauth)onProxyReq— dynamically forwardsAuthorizationandx-forwarded-access-tokenheaders per requestheaders: getProxyHeaders()(static) andonProxyReq(dynamic)How Has This Been Tested?
Tested manually in the model-registry module (same fix pattern) against an ODH cluster:
DEV_IMPERSONATE_USERandDEV_IMPERSONATE_PASSWORDsetonProxyReq, the incoming auth header from the host proxy is forwarded correctly